package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

/**
 * @Author: wenjingyuan
 * @Date: 2023/05/29/19:41
 * @Description:一次性读取
 */
public class InpurStreamDemo3 {
    public static void main(String[] args) {
        try(InputStream inputStream=new FileInputStream("b.txt")) {
            byte[] bytes=new byte[1024];
            while(true){//如果数据超过了byte容量，会读取多次
                int c=inputStream.read(bytes);
                if(c==-1) break;
                Thread.sleep(200);
                System.out.println(new String(bytes,"utf-8"));
            }
        } catch (Exception e) {
        }
    }
}
